package com.example.pdm_project_group_001;
 

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.app.Activity; 
import android.content.Intent;


public class ReportIssuesEmail extends Activity {
	
	Button sendEmail;
	EditText msg;
	
	

	@Override
	
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.reportissues);
		
		
		
		sendEmail = (Button) findViewById(R.id.sendEmailbtn);
		sendEmail.setOnClickListener(new OnClickListener() {
			
			@Override
			 
			public void onClick(View v) {
				msg = (EditText) findViewById(R.id.emailmsgTxt);
				String message = msg.getText().toString();;
				sendEmail(message);
			}
			
		});
		
	}

	private void sendEmail(String message) {
				
				String[] to=new String[]{"navin.deneth@gmail.com"};
				String subject=("Report an Issue");
				Intent emailIntent = new Intent(Intent.ACTION_SEND);
				emailIntent.putExtra(Intent.EXTRA_EMAIL, to);
				emailIntent.putExtra(Intent.EXTRA_SUBJECT,  subject);
				emailIntent.putExtra(Intent.EXTRA_TEXT, message);
				emailIntent.setType("Message/rfc822");
				startActivity(Intent.createChooser(emailIntent, "Email"));
				

	}

}
